<template>
	<view>
		<u-datetime-picker :value="Number(new Date())" @confirm="confirm" :itemHeight="80" closeOnClickOverlay
			@close="$emit('update:show', false)" @cancel="$emit('update:show', false)" :formatter="formatter"
			:show="show" mode="year-month">
		</u-datetime-picker>
	</view>
</template>

<script>
	export default {
		name: "myDatePick",
		props: ["show"],

		data() {
			return {};
		},
		methods: {
			formatter(type, value) {
				// console.log(type, value)
				if (type === 'year') {
					return `${value}年`
				}
				if (type === 'month') {
					return `${value}月`
				}
			
				return value
			},
			confirm(e) {
				// console.log(e.value)
				this.$emit("bindDateChange", uni.$u.timeFormat(e.value, 'yyyy-mm'))
				this.$emit('update:show', false)
			}
		},
	
	}
</script>

<style>

</style>
